﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IssueIT.Core.Domain;
using IssueIT.Core.Services;
using NUnit.Framework;

namespace IssueIT.Core.Tests.Services
{
    [TestFixture]
    public class ProjectUriValidatorTest
    {


        [Test]
        public void Can_validate_projectUri()
        {
            
            string projectUri = "project1";
            var sut = new ProjectUriValidator(projectUri);

            Assert.IsTrue(sut.IsAllowed);
        }

        [Test]
        public void Can_validate_nonUri_caraters_not_allowed_in_projectUri()
        {
            
            string projectUri = "æøåproject1";
            var sut = new ProjectUriValidator(projectUri);
            
            Assert.IsFalse(sut.IsAllowed);
        }

        [Test]
        public void Can_validate_space_caraters_not_allowed_in_projectUri()
        {
            
            string projectUri = "project 1";
            var sut = new ProjectUriValidator(projectUri);
            
            Assert.IsFalse(sut.IsAllowed);
        }

        [Test]
        public void Can_get_valid_Uri_from_valid_offset()
        {
            string projectUri = "project1";
            var sut = new ProjectUriValidator(projectUri);

            Assert.AreEqual(projectUri, sut.AllowedUri);
        }

        [Test]
        public void Can_get_valid_Uri_from_UPPERCASE_valid_offset()
        {
            string projectUri = "PROJECT";
            var sut = new ProjectUriValidator(projectUri);

            Assert.AreNotEqual(projectUri, sut.AllowedUri);
        }
    }
}